/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cassys.ejb.sessionbean;

import cassys.dataaccess.DAOException;
import cassys.dataaccess.DAOFactory;
import cassys.dataaccess.ModuleDAO;
import cassys.dataaccess.TeamDAO;
import cassys.datatransferobjects.ModuleDTO;
import cassys.datatransferobjects.TeamDTO;
import java.util.ArrayList;
import javax.ejb.Stateless;
import javax.ejb.LocalBean;

/**
 *
 * @author ASUS
 */
@Stateless(mappedName = "TeamBean")
public class TeamBean implements TeamBeanRemote {

    private TeamDAO teamDAO = null;

    public TeamBean() {
    }

    public void ejbCreate() {

        teamDAO = DAOFactory.getInstance().getTeamDAO();
    }

    @Override
    public ArrayList<TeamDTO> findAllTeams() throws DAOException {
        return teamDAO.findAllTeam();
    }

    @Override
    public TeamDTO findTeam(String teamId) throws DAOException {
        return teamDAO.findTeam(teamId);
    }

    @Override
    public void insertTeam(TeamDTO team) throws DAOException {
        teamDAO.insertTeam(team);
    }

    @Override
    public void updateTeam(TeamDTO team) throws DAOException {
        teamDAO.updateTeam(team);
    }

    @Override
    public void deleteTeam(TeamDTO team) throws DAOException {
        teamDAO.deleteTeam(team);

    }

    @Override
    public ArrayList<TeamDTO> findAllTeamsByModule(String moduleCode) throws DAOException {
        return teamDAO.findAllTeamByModule(moduleCode);
    }
}
